package com.example.liu.day9_17;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

public class Main2Activity extends AppCompatActivity implements View.OnClickListener{
        private TextView tv_lianxirun;
        private TextView tv_lianxirun1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        tv_lianxirun  = findViewById(R.id.tv_lianxirun);
        tv_lianxirun1  = findViewById(R.id.tv_lianxirun1);
            tv_lianxirun.setOnClickListener(this);
            tv_lianxirun1.setOnClickListener(this);
    }

    Intent intent = new Intent();
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tv_lianxirun:
                intent.putExtra("lianxirun",tv_lianxirun.getText().toString());
                setResult(0,intent);
                finish();
                break;
            case R.id.tv_lianxirun1:
                    intent.putExtra("lianxirun",tv_lianxirun1.getText().toString());
                    setResult(0,intent);
                    finish();
                break;
        }
    }
}
